package com.huaxin.hxcloud.find;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.huaxin.hxcloud.R;
import com.huaxindata.im.main.addFriend.AddFriendActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/5/15.
 */

public class FindUserActivity extends AppCompatActivity {

    @BindView(R.id.toolbar)
    Toolbar toolbar;

    @BindView(R.id.user_icon)
    ImageView userImgView;
    @BindView(R.id.user_name)
    TextView userNameTv;
    @BindView(R.id.user_nickname)
    TextView userNickNameTv;

    private String userNickName;
    private String userIconUrl;
    private int userId;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_find_user_info);
        initData();
        ButterKnife.bind(this);
        initView();
    }
    private void initData() {
        Intent intent = getIntent();
        userNickName=intent.getStringExtra("nickName");
        userIconUrl=intent.getStringExtra("icon");
        userId = intent.getIntExtra("id", 0);
    }

    private void initView() {
        setSupportActionBar(toolbar);
        toolbar.setTitle("用户信息");
        userNameTv.setText(userNickName);
        userNickNameTv.setText(userNickName);
        Glide.with(this).load(userIconUrl).into(userImgView);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    //点击加为好友按钮
    public void addFriend(View view) {
        if (view.getId() == R.id.user_add_friend) {
            Intent intent = new Intent(this, AddFriendActivity.class);
            intent.putExtra("type", 0);
            intent.putExtra("nickName", userNickName);
            intent.putExtra("icon", userIconUrl);
            intent.putExtra("clientId",0);
            startActivity(intent);
            finish();
        }
    }

}
